package Year2021.month10.Day21;

import java.util.Scanner;

public class MarketTest {
    public static void main(String[] args) {
       Market m=new Market();
       m.name="好日子超市";
       m.address="地球上";
       m.show1();
        Scanner in = new Scanner(System.in);
        int choice = 0;
        while (true) {
            System.out.println("0:添加新会员，1:显示会员信息，2：涨积分，3：兑换礼品");
            choice = in.nextInt();
            if (choice == 0) {
                System.out.println("请输入要添加会员的名字");
                String newName = in.next();
                System.out.println("请输入会员的会员号");
                int memberNumber = in.nextInt();
                boolean chongfu=m.checkCardNoRepeat(memberNumber);
                if (chongfu){
                    System.out.println("请重新输入");
                    memberNumber=in.nextInt();
                }
                System.out.println("请输入会员的手机号");
                String phoneNumber = in.next();
                System.out.println("请输入会员的积分");
                int integral = in.nextInt();
                m.add(newName,memberNumber,phoneNumber,integral);
            } else if (choice == 1) {
                m.show();
            }else if (choice==2){
                System.out.println("请输入需要涨分的会员名字");
                String cardNO=in.next();
                System.out.println("请输入需要涨的积分");
                int fen=in.nextInt();
                m.inc(cardNO,fen);
            }else if (choice==3){
                System.out.println("请输入你的会员卡号");
                int cardNo=in.nextInt();
                System.out.println("请输入需要兑换的礼品类型,1:100分兑换餐巾纸一包,2:400分兑换剃须刀一把," +
                        "3:1000分兑换炒锅一个");
                int lipingleixing=in.nextInt();
                m.duihuan(cardNo,lipingleixing);

            }
        }
    }
}
